/* -----------------------------------------------------------------------------
 * PROJECT    : net.lwf
 * FILE       : fPageFormat.java
 *
 * HISTORY:
 * Date          Author                        Description
 * ----------------------------------------------------------------------------- 
 * Jan 19, 2009       Raghu Sarraff			       Created
 */
package lwf.handler.helper;

import java.util.List;

public class FormatAttribute {
	
	private boolean showtextarea = false;
	private int questionType = 0;
	private boolean addOnClickForOK = false;
	private String questionNumber;
	private String questionTable;
	private List radioAnswers;
	private boolean verticalradioanswers = false;
	private String answerType;
	private String textboxwidth = null;
	private String textarearows = "2";
	private String textareacolumns = "50";
	private boolean showAmpmBox = false;
	
	

	/**
	 * @return Returns the showAmpmBox.
	 */
	public boolean showAmpmBox() {
		return showAmpmBox;
	}
	/**
	 * @param showAmpmBox The showAmpmBox to set.
	 */
	public void setShowAmpmBox(boolean showAmpmBox) {
		this.showAmpmBox = showAmpmBox;
	}
	/**
	 * @return Returns the textareacolumns.
	 */
	public String getTextareacolumns() {
		return textareacolumns;
	}
	/**
	 * @param textareacolumns The textareacolumns to set.
	 */
	public void setTextareacolumns(String textareacolumns) {
		this.textareacolumns = textareacolumns;
	}
	/**
	 * @return Returns the textarearows.
	 */
	public String getTextarearows() {
		return textarearows;
	}
	/**
	 * @param textarearows The textarearows to set.
	 */
	public void setTextarearows(String textarearows) {
		this.textarearows = textarearows;
	}
	/**
	 * @return Returns the textboxwidth.
	 */
	public String getTextboxwidth() {
		return textboxwidth;
	}
	/**
	 * @param textboxwidth The textboxwidth to set.
	 */
	public void setTextboxwidth(String textboxwidth) {
		this.textboxwidth = textboxwidth;
	}
	/**
	 * @return Returns the answerType.
	 */
	public String getAnswerType() {
		return answerType;
	}
	/**
	 * @param answerType The answerType to set.
	 */
	public void setAnswerType(String answerType) {
		this.answerType = answerType;
	}
	/**
	 * @return Returns the verticalradioanswers.
	 */
	public boolean isVerticalradioanswers() {
		return verticalradioanswers;
	}
	/**
	 * @param verticalradioanswers The verticalradioanswers to set.
	 */
	public void setVerticalradioanswers(boolean verticalradioanswers) {
		this.verticalradioanswers = verticalradioanswers;
	}
	/**
	 * @return Returns the addOnClickForOK.
	 */
	public boolean isAddOnClickForOK() {
		return addOnClickForOK;
	}
	/**
	 * @param addOnClickForOK The addOnClickForOK to set.
	 */
	public void setAddOnClickForOK(boolean addOnClickForOK) {
		this.addOnClickForOK = addOnClickForOK;
	}
	
	public void setQuestionTable(String title, String question) {
		this.questionTable = this.generateQuestionTable(title, question);
	}
	
	/**
	 * @return Returns the questionType.
	 */
	public int getQuestionType() {
		//throw net.lwf.exception if questionType is NULL
		return questionType;
	}
	/**
	 * @param questionType The questionType to set.
	 */
	public void setQuestionType(int questiontype) {
		this.questionType = questiontype;
	}
	/**
	 * @return Returns the showtextarea.
	 */
	public boolean isShowtextarea() {
		return showtextarea;
	}
	/**
	 * @param showtextarea The showtextarea to set.
	 */
	public void setShowtextarea(boolean showtextarea) {
		this.showtextarea = showtextarea;
	}
	
	
	/**
	 * @return Returns the questionNumber.
	 */
	public String getQuestionNumber() {
		//show net.lwf.exception if questionNumber is NULL
		return questionNumber;
	}
	/**
	 * @param questionNumber The questionNumber to set.
	 */
	public void setQuestionNumber(String questionNumber) {
		this.questionNumber = questionNumber;
	}
	
	
	/**
	 * @return Returns the questionTable.
	 */
	public String getQuestionTable() {
		//show net.lwf.exception if questionTable is NULL 
		return this.questionTable;
	}
	/**
	 * @param questionTable The questionTable to set.
	 */
	public void setQuestionTable(String questionTable) {
		this.questionTable = questionTable;
	}
	
	
	/**
	 * @return Returns the radioAnswers.
	 */
	public List getRadioAnswers() {
		return radioAnswers;
	}
	/**
	 * @param radioAnswers The radioAnswers to set.
	 */
	public void setRadioAnswers(List radioAnswers) {
		this.radioAnswers = radioAnswers;
	}
	
	
	//if possible push this to question formatter
	private String generateQuestionTable(String qTitle, String question) {
		StringBuffer sbQBlock = new StringBuffer();
		sbQBlock.append("<table border=\"0\"  width=\"55%\" align=\"center\" cellspacing=\"2\" cellpadding=\"0\">");
			sbQBlock.append("<tr>");
				sbQBlock.append("<td class=\"tableHeader\" colspan=\"3\" nowrap>");
					sbQBlock.append(qTitle);
				sbQBlock.append("</td>");
			sbQBlock.append("</tr>");			
			sbQBlock.append("<tr>");
				sbQBlock.append("<td width=\"30%\"> &nbsp; </td>");
       			sbQBlock.append("<td width=\"5%\"> &nbsp; </td>");
       			sbQBlock.append("<td width=\"15%\"> &nbsp; </td>");
		    sbQBlock.append("</tr>");
		    sbQBlock.append("<tr>");
	   			sbQBlock.append("<td colspan=\"3\" class=\"datacenter\">");
	   				sbQBlock.append(question);
	   			sbQBlock.append("</td>");
		    sbQBlock.append("</tr>");
        	sbQBlock.append("<tr>");
				sbQBlock.append("<td colspan=\"3\" > &nbsp; </td>"); 
			sbQBlock.append("</tr>");
        	sbQBlock.append("<tr>");
				sbQBlock.append("<td class=\"tableHeader\" colspan=\"3\" nowrap>");
					sbQBlock.append("<hr>");
				sbQBlock.append("</td>");
        	sbQBlock.append("</tr>");
        sbQBlock.append("</table>");
        
        String abcd = sbQBlock.toString();
		return sbQBlock.toString();	
	}

}

